package br.com.getdiscount.tcc.model.preco;

import java.io.Serializable;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.bean.SessionScoped;

import br.com.getdiscount.base.bean.AbstractManegedBean;
import br.com.getdiscount.tcc.GdServiceLocator;

@SuppressWarnings("serial")
@SessionScoped
@ManagedBean(name="precoBean")
public class PrecoBean extends AbstractManegedBean<Preco> implements Serializable {
	
	private FiltroDTO filtroDTO;
	
	@Override
	protected void initializeEntity() {
		setEntity( new Preco() );
	}
	
	@PostConstruct
	public void carregaPreco() {
		setFiltroDTO(new FiltroDTO());

	}

	public FiltroDTO getFiltroDTO() {
		return filtroDTO;
	}

	public void setFiltroDTO(FiltroDTO filtroDTO) {
		this.filtroDTO = filtroDTO;
	}
	
	public void consultarDW() {
		setRows(GdServiceLocator.getInstance().getPrecoService().findAllPrecoHistorico(getEntity()));
	}
	
}
